package com.client.mapper;

import com.Emplyment.vo.ResumeTemplateDownAndPreviewVo;
import com.Emplyment.vo.ResumeTemplateVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ResumeTemplateMapper {

    @Select("SELECT * FROM resume_template")
   List<ResumeTemplateVo> getResumeTemplate();

    @Insert("INSERT INTO resume_template(name, fileType, createTime,url,size) VALUES(#{name}, #{fileType}, #{createTime},#{url},#{size})")
    void insertTemplate(ResumeTemplateVo resumeTemplateVo);

    @Select("SELECT name,preview_file FROM resume_template WHERE id = #{templateId}")
    ResumeTemplateDownAndPreviewVo ByIdGetResumeTemplate(Integer templateId);

    @Select("SELECT name,down_file FROM resume_template WHERE id = #{templateId}")
    ResumeTemplateDownAndPreviewVo ByIdDownResumeTemplate(Integer templateId);

    @Select("SELECT COUNT(*) FROM super_user WHERE username = #{username}")
    int isNotSuperUser(String username);

    @Select("SELECT COUNT(*) FROM buy_template WHERE template_Id = #{templateId} and username = #{username}")
    int buyTemplate(Integer templateId, String username);
}
